package com.example.carapi.service.implement;

import com.example.carapi.bean.CarLike;
import com.example.carapi.mapper.CarLikeMapper;
import com.example.carapi.service.CarLikeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CarLikeServiceImplement implements CarLikeService {
    @Autowired
    private CarLikeMapper carLikeMapper;

    @Override
    public CarLike getCarLikeById(Long id) {
        return carLikeMapper.getOne(id);
    }

    @Override
    public List<CarLike> getCarLikes() {
        return carLikeMapper.getAll();
    }

    @Override
    public void addCarLike(CarLike carLike) {
        carLikeMapper.insert(carLike);
    }

    @Override
    public void updateCarLike(CarLike carLike) {
        carLikeMapper.update(carLike);
    }

    @Override
    public void deleteCarLikeById(Long id) {
        carLikeMapper.delete(id);
    }
}
